package 测试;

import java.util.Scanner;

public class 矩阵元素相乘 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int n = Integer.parseInt(sc.next());
			int m = Integer.parseInt(sc.next());
			int[][] a = new int[n][m];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					a[i][j] = Integer.parseInt(sc.next());
				}
			}
			System.out.println(func(n, m, a));
		}
		sc.close();
	}

	public static long func(int n, int m, int[][] a) {
		long max = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				max = Math.max(max, product(a, n, m, i, j));
			}
		}
		return max;
	}

	private static long product(int[][] a, int n, int m, int x, int y) {
		long product = 1;
		for (int i = 0; i < n; i++) {
			if (i != x) {
				product *= a[i][y];
			}
		}
		for (int j = 0; j < m; j++) {
			if (j != y) {
				product *= a[x][j];
			}
		}
		return product;
	}

}
